﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace KeyRemapper
{
    public class MapGenerator
    {
        public static readonly List<Keys> ValidKeys = new List<Keys>() {   
                                                                           Keys.A, Keys.B, Keys.C, 
                                                                           Keys.D, Keys.E, Keys.F, 
                                                                           Keys.G, Keys.H, Keys.I,
                                                                           Keys.J, Keys.K, Keys.L,
                                                                           Keys.M, Keys.N, Keys.O, 
                                                                           Keys.P, Keys.Q, Keys.R, 
                                                                           Keys.S, Keys.T, Keys.U, 
                                                                           Keys.V, Keys.W, Keys.X, 
                                                                           Keys.Y, Keys.Z,
                                                                           Keys.D1, Keys.D2, Keys.D3, 
                                                                           Keys.D4, Keys.D5, Keys.D6, 
                                                                           Keys.D7, Keys.D8, Keys.D9, 
                                                                           Keys.D0
                                                                       };

        public static SortedList<Keys, Keys> Generate(int seed)
        {
            EnsureUniqueRandom rnd = new EnsureUniqueRandom(seed);
            SortedList<Keys, Keys> map = new SortedList<Keys, Keys>();

            for (int i = 0; i < ValidKeys.Count; i++)
            {
                map.Add(ValidKeys[i], ValidKeys[rnd.Next(0, ValidKeys.Count)]);
            }

            return map;
        }
    }
}
